<template>
    <el-affix position="bottom" :offset="40">
        <el-button type="primary" @click="logoutCommand">退出登录</el-button>
    </el-affix>
</template>

<script setup>
import {useRouter} from "vue-router";
import {logout} from "@/api/Auth.ts";
import {ElMessage} from "element-plus";

const router=useRouter()

const logoutCommand=()=>{
    logout().then(response=>{
        ElMessage.success("退出登录成功！")
        window.localStorage.removeItem("cloudToken")
        router.push({name:'login'})
    }).catch((error)=>{
        // ElMessage.error(error.response.data.data)
        console.log(error.response)
    })
}
</script>

<style scoped>

</style>